import { View, Image } from '@tarojs/components'
import { useLoad } from '@tarojs/taro'
import './index.scss'
import { AtButton } from 'taro-ui'
import { useSelector } from 'react-redux'
import Taro from '@tarojs/taro'

const Recommend = () => {
  const isLoggedIn = useSelector((state: any) => state.user?.isLoggedIn ?? false)

  const handleLogin = () => {
    Taro.navigateTo({
      url: '/packageContacts/pages/login/index'
    })
  }

  useLoad(() => {
    console.log('Page loaded.')
  })

  return (
    <View className='recommend-page'>
      {!isLoggedIn ? (
        <View className='empty-state'>
          <View className='empty-text'>空空如也~</View>
          <AtButton 
            className='login-btn'
            onClick={handleLogin}
          >
            去登录
          </AtButton>
        </View>
      ) : (
        <View className='recommend-content'>
          {/* 这里放登录后的推荐内容 */}
        </View>
      )}
    </View>
  )
}

export default Recommend